breed [bees bee]
breed [roses rose]
breed [cosmos cosmo]
breed [thistles thistle]
breed [sunflowers sunflower]
breed [lavenders lavender]
breed [bee-hives bee-hive]
;these are the breeding factors that make them into turtles
bees-own [pollination-l bees-flying bees-working sick? life population population-s]
roses-own [pollination-l population sick? population-s life]
cosmos-own [pollination-l population sick? population-s life]
sunflowers-own [pollination-l population sick? population-s life]
thistles-own [pollination-l population sick? population-s life]
;this is going to tell the certain turtles what they own
to setup
clear-all
reset-ticks
create-bees num-bees
create-roses num-roses
create-cosmos num-cosmos
create-thistles num-thistles
create-sunflowers num-sunflowers
ask bees [
set shape "bee 2"
setxy random-xcor random-ycor
set color yellow
set pollination-l 100
set size 1
set life 100
set population bees with [sick? = false]
set population-s bees with [sick? = true]
set bees-flying true
set bees-working false
set sick? false ]
ask roses [
set shape "rose"
set color red
set size 5
set life 100
set population roses with [sick? = false]
set population-s roses with [sick? = true]
set sick? false
set pollination-l 1
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]]
ask cosmos [
set shape "cosmo"
set color colorc
set size 2
set life 100
set sick? false
set population cosmos with [sick? = false]
set population-s cosmos with [sick? = true]
set pollination-l 200
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]]
ask thistles [
set shape "thistle"
set color pink
set size 1.5
set pollination-l 1
set sick? false
set life 100
set population thistles with [sick? = false]
set population-s thistles with [sick? = true]
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]]
ask sunflowers [
set shape "sunflower"
set color yellow
set size 1.5
set pollination-l 1
set sick? false
set life 100
set population sunflowers with [sick? = false]
set population-s sunflowers with [sick? = true]
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]]
ask patches[
set pcolor pcolor'
]
end
To go
ask bees[
if not any? thistles-here and not any? cosmos-here and not any? sunflowers-here and not any? roses-here with [sick? = false][
set bees-flying true]
if bees-flying = true[
forward random 5
right random 45
left random 45
if any? roses in-radius .2 with [sick? = false]
[face one-of roses in-radius .2 with [sick? = false]
forward .2]
if any? roses-here with [sick? = false][
set bees-flying false
set bees-working true
set pollination-l pollination-l - 1]
if any? cosmos in-radius .2 with [sick? = false]
[face one-of cosmos in-radius .2 with [sick? = false]
forward .2]
if any? cosmos-here with [sick? = false][
set bees-flying false
set bees-working true
set pollination-l pollination-l - 1]
if any? sunflowers in-radius .2 with [sick? = false]
[face one-of sunflowers in-radius .2 with [sick? = false]
forward .2]
if any? sunflowers-here with [sick? = false][
set bees-flying false
set bees-working true
set pollination-l pollination-l - 1]
if any? thistles in-radius .2 with [sick? = false]
[face one-of thistles in-radius .2 with [sick? = false]
forward .2]
if any? thistles-here with [sick? = false][
set bees-flying false
set bees-working true
set pollination-l pollination-l - 1]
]
ask roses[
if any? bees-here with [sick? = false][
set pollination-l pollination-l + 1]
if life = 0 [
die]
if sick? = true [set life life - 1]
if pollination-l = 300 [
hatch-roses 1[
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]
set pollination-l 100
set life 100]
set life life - 100]]
;if population = 0 [
ask cosmos[
if any? bees-here with [sick? = false][
set pollination-l pollination-l + 1]
if sick? = true [set life life - 1]
if life = 0 [
die]
if pollination-l = 300 [
hatch-cosmos 1[
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]
set pollination-l 100
set life 100]
set life life - 100]]
ask thistles[
if any? bees-here with [sick? = false][
set pollination-l pollination-l + 1]
if sick? = true [set life life - 1]
if life = 0 [
die]
if pollination-l = 300 [
hatch-thistles 1[
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]
set pollination-l 100
set life 100]
set life life - 100]]
ask sunflowers[
if any? bees-here with [sick? = false][
set pollination-l pollination-l + 1]
if sick? = true [set life life - 1]
if life = 0 [
die]
if pollination-l = 300 and sick? = false[
hatch-sunflowers 1[
setxy random-xcor random-ycor
while [any? other roses-here]
[setxy random-xcor random-ycor]
while [any? other cosmos-here]
[setxy random-xcor random-ycor]
while [any? other thistles-here]
[setxy random-xcor random-ycor]
while [any? other sunflowers-here]
[setxy random-xcor random-ycor]
while [any? other lavenders-here]
[setxy random-xcor random-ycor]
set pollination-l 100
set life 100]
set life life - 100]]
]tick
end
to spread-disease
ask bee 1 [
if ticks = 20 [
set sick? true ]]
ask bees [
if any? roses-here with [sick? = true][
set sick? true]
if any? cosmos-here with [sick? = true][
set sick? true]
if any? thistles-here with [sick? = true][
set sick? true]
if any? sunflowers-here with [sick? = true][
set sick? true]
if any? other bees-here with [sick? = true][
set sick? true]
if sick? = true [
set color red
set life life - 10]]
ask roses [
if any? bees-here with [sick? = true][
set color grey
set sick? true]
if sick? = true [
set life life - 10]]
ask cosmos [
if any? bees-here with [sick? = true][
set color grey]
if sick? = true [
set life life - 10]]
ask thistles [
if any? bees-here with [sick? = true][
set color grey]
if sick? = true [
set life life - 10]]
ask sunflowers [
if any? bees-here with [sick? = true][
set color grey]
if sick? = true [
set life life - 10]]
end